//
//  AppointmentReport.m
//  WorkManager
//
//  Created by iD Student on 7/17/12.
//  Copyright (c) 2012 iD Student. All rights reserved.
//

#import "AppointmentReport.h"

@implementation AppointmentReport
@synthesize name;
@synthesize phone;
@synthesize email;
@synthesize address;
@synthesize town;
@synthesize state;
@synthesize date;
@synthesize workRequestDetails;
@synthesize workReport;
@synthesize rate;
@synthesize amount;
@synthesize hoursWorked;
@synthesize paymentType;
@synthesize signature;
- (id)init
{
    self = [super init];
    if (self) {
        self.date = [NSDate date];
        paymentType = 1;
    }
    return self;
}

- (void)dealloc
{
    [name release];
    [phone release];
    [email release];
    [address release];
    [town release];
    [state release];
    [date release];
    [workRequestDetails release];
    [workReport release];
    [rate release];
    [amount release];
    [hoursWorked release];
    [signature release];
    [super dealloc];
}

- (void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeObject:name forKey:@"name"];
    [coder encodeObject:phone forKey:@"phone"];
    [coder encodeObject:email forKey:@"email"];
    [coder encodeObject:address forKey:@"address"];
    [coder encodeObject:town forKey:@"town"];
    [coder encodeObject:state forKey:@"state"];
    [coder encodeObject:date forKey:@"date"];
    [coder encodeObject:workRequestDetails forKey:@"workRequestDetails"];
    [coder encodeObject:workReport forKey:@"workReport"];
    [coder encodeObject:rate forKey:@"rate"];
    [coder encodeObject:amount forKey:@"amount"];
    [coder encodeObject:hoursWorked forKey:@"hoursWorked"];
    [coder encodeInt:paymentType forKey:@"paymentType"];
    [coder encodeObject:signature forKey:@"signature"];
}

- (id)initWithCoder:(NSCoder *)decoder
{
    self = [super init];
    if (self) {
        self.name = [decoder decodeObjectForKey:@"name"];
        self.phone = [decoder decodeObjectForKey:@"phone"];
        self.email = [decoder decodeObjectForKey:@"email"];
        self.address = [decoder decodeObjectForKey:@"address"];
        self.town = [decoder decodeObjectForKey:@"town"];
        self.state = [decoder decodeObjectForKey:@"state"];
        self.date = [decoder decodeObjectForKey:@"date"];
        self.workRequestDetails = [decoder decodeObjectForKey:@"workRequestDetails"];
        self.workReport = [decoder decodeObjectForKey:@"workReport"];
        self.rate = [decoder decodeObjectForKey:@"rate"];
        self.amount = [decoder decodeObjectForKey:@"amount"];
        self.hoursWorked = [decoder decodeObjectForKey:@"hoursWorked"];
        self.paymentType = [decoder decodeIntForKey:@"paymentType"];
        self.signature = [decoder decodeObjectForKey:@"signature"];
    }
    return self;
}

@end
